package cn.aloxc.tianya.reader;

import java.util.ArrayList;

import android.app.Activity;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.Menu;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class Activity_test_list_array extends Activity{
	public static final int item0 = Menu.FIRST;
	public static final int item1 = Menu.FIRST + 1;
	private String[] site = {"天涯社区",
			"海南在线",
			"搜狐在线",
			"理想在线",
			"迅雷网络",
			"popo网络",
			"it168网",
			"太平洋",
			"中关村",
			"网易科技",
			"谷歌搜索"};
	public void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
        Bundle data = this.getIntent().getExtras();
        setTitle(data.getString("testItem"));
        ArrayList<String> array = new ArrayList<String>();
        for (int i = 0; i < site.length; i++) {
			array.add(site[i]);
		}
        DisplayMetrics metrics = new DisplayMetrics();
        getWindow().getWindowManager().getDefaultDisplay().getMetrics(metrics);
        array.add(metrics.widthPixels + " X " + metrics.heightPixels);
        
        ListView lv = new ListView(this);
        lv.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,array.toArray(new String[array.size()])));
        lv.setItemsCanFocus(true);
        lv.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
        lv.setBackgroundResource(R.drawable.caoyuan);
        setContentView(lv);
        
	}
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		menu.add(0,item0,0, "button0");
		menu.add(0,item1,0, "button0");
		menu.findItem(item0);
		return super.onCreateOptionsMenu(menu);
	}
}

